package cloud.maque.auth.controller;

import cloud.maque.auth.handler.login.LoginHandlerInterface;
import cloud.maque.auth.model.LoginRequest;
import cloud.maque.auth.model.LoginResponse;
import cloud.maque.common.core.response.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Tag(name = "登陆认证入口")
@RestController
@RequestMapping("/auth")
public class BaseAuthController {


    @Autowired
    LoginHandlerInterface loginHandler;

    @Operation(summary = "用户认证")
    @PostMapping("/login")
    public R Login(@RequestBody LoginRequest request) {
        LoginResponse result = loginHandler.login(request);
        return R.ok("登陆成功", result);
    }


}
